//
//  HomeADView.m
//  BaseProject
//
//  Created by 王洋 on 2020/12/1.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "HomeADView.h"

@implementation HomeADView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.adImageView sd_setImageWithURL:[NSURL URLWithString:B_FREENEW_HOME_AD]  placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
    self.adImageView.userInteractionEnabled = YES;
    WEAKSELF
    [self.adImageView addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (weakSelf.HomeADViewBlock) {
            weakSelf.HomeADViewBlock(HomeADViewActionType_jump);
        }
    }];
    
    self.userInteractionEnabled = YES;
    [self addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
        if (weakSelf.HomeADViewBlock) {
            weakSelf.HomeADViewBlock(HomeADViewActionType_close);
        }
    }];
    
}

- (IBAction)closeAction:(id)sender {
    
    if (self.HomeADViewBlock) {
        self.HomeADViewBlock(HomeADViewActionType_close);
    }
}


@end
